package com.snail.billing.fragment;

import android.content.Intent;
import android.net.Uri;
import android.text.Html;
import android.view.View;
import android.widget.TextView;

import com.android.os.Page;
import com.android.util.ResUtil;
import com.snail.billing.Resource;

public class PhoneFragment extends Page implements View.OnClickListener {

	private TextView textTitle;
	private View buttonBack;

	private TextView text1;
	private TextView text2;
	
	@Override
	public int createLayoutId() {
		return ResUtil.getLayoutId(Resource.layout.snailbilling_phone_activity);
	}

	@Override
	public void onCreate() {
		super.onCreate();
		textTitle = (TextView) findViewById(ResUtil.getViewId(Resource.id.snailbilling_title_text));
		textTitle.setText(ResUtil.getString(Resource.string.snailbilling_user_center_text_phone));
		buttonBack = findViewById(ResUtil.getViewId(Resource.id.snailbilling_title_button_back));
		buttonBack.setOnClickListener(this);
		//
		text1 = (TextView) findViewById(ResUtil.getViewId(Resource.id.snailbilling_phone_text1));
		text2 = (TextView) findViewById(ResUtil.getViewId(Resource.id.snailbilling_phone_text2));
		text1.setText(Html.fromHtml("<span>客服热线(7×24小时)：\n<font color=\"#ffa04c\">0512-67631800</font></span>"));
		text2.setText(Html.fromHtml("<span>投诉热线(7×24小时)：\n<font color=\"#27a5fe\">0512-67631800-4</font></span>"));
		text1.setOnClickListener(this);
		text2.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		if (v.equals(buttonBack)) {
			getPageManager().backward();
		} else if (v.equals(text1)) {
			Uri uri = Uri.parse("tel:0512-67631800");
			Intent it = new Intent(Intent.ACTION_DIAL, uri);
			getPageManager().startActivity(it);
		} else if (v.equals(text2)) {
			Uri uri = Uri.parse("tel:0512-67631800");
			Intent it = new Intent(Intent.ACTION_DIAL, uri);
			getPageManager().startActivity(it);
		}
	}

}
